package com.javatest.springboot2ratelimit.annoation;

import com.javatest.springboot2ratelimit.enums.RateLimitFineness;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2020-07-21 下午3:08
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MakeRateLimit {
    /**
     * 限流时长.单位秒
     *
     * @return the int
     */
    int limitPeriod() default 1;

    /**
     * 限流访问上限.
     *
     * @return the int
     */
    int limitCount() default 20;

    /**
     * 限流粒度,可以是ip地址, 用户, 默认采用接口限流
     *
     * @return the limit object
     */
    RateLimitFineness limitFineness() default RateLimitFineness.Interface;
}
